home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / brkthru.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  24KB  |  636 lines

  1. /***************************************************************************
  2. Break Thru Doc. Data East (1986)
  3.  
  4. driver by Phil Stroffolino
  5.  
  6. UNK-1.1    (16Kb)  Code (4000-7FFF)
  7. UNK-1.2    (32Kb)  Main 6809 (8000-FFFF)
  8. UNK-1.3    (32Kb)  Mapped (2000-3FFF)
  9. UNK-1.4    (32Kb)  Mapped (2000-3FFF)
  10.  
  11. UNK-1.5    (32Kb)  Sound 6809 (8000-FFFF)
  12.  
  13. Background has 4 banks, with 256 16x16x8 tiles in each bank.
  14. UNK-1.6    (32Kb)  GFX Background
  15. UNK-1.7    (32Kb)  GFX Background
  16. UNK-1.8    (32Kb)  GFX Background
  17.  
  18. UNK-1.9    (32Kb)  GFX Sprites
  19. UNK-1.10   (32Kb)  GFX Sprites
  20. UNK-1.11   (32Kb)  GFX Sprites
  21.  
  22. Text has 256 8x8x4 characters.
  23. UNK-1.12   (8Kb)   GFX Text
  24.  
  25. **************************************************************************
  26. Memory Map for Main CPU by Carlos A. Lozano
  27. **************************************************************************
  28.  
  29. MAIN CPU
  30. 0000-03FF                                   W                   Plane0
  31. 0400-0BFF                                  R/W                  RAM
  32. 0C00-0FFF                                   W                   Plane2(Background)
  33. 1000-10FF                                   W                   Plane1(sprites)
  34. 1100-17FF                                  R/W                  RAM
  35. 1800-180F                                  R/W                  In/Out
  36. 1810-1FFF                                  R/W                  RAM (unmapped?)
  37. 2000-3FFF                                   R                   ROM Mapped(*)
  38. 4000-7FFF                                   R                   ROM(UNK-1.1)
  39. 8000-FFFF                                   R                   ROM(UNK-1.2)
  40.  
  41. Interrupts: Reset, NMI, IRQ
  42. The test routine is at F000
  43.  
  44. Sound: YM2203 and YM3526 driven by 6809.  Sound added by Bryan McPhail, 1/4/98.
  45.  
  46. ***************************************************************************/
  47.  
  48. #include "driver.h"
  49. #include "vidhrdw/generic.h"
  50. #include "cpu/m6809/m6809.h"
  51.  
  52.  
  53. unsigned char *brkthru_nmi_enable; /* needs to be tracked down */
  54. extern unsigned char *brkthru_videoram;
  55. extern size_t brkthru_videoram_size;
  56.  
  57. WRITE_HANDLER( brkthru_1800_w );
  58. int brkthru_vh_start(void);
  59. void brkthru_vh_stop(void);
  60. void brkthru_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  61. void brkthru_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  62.  
  63.  
  64. static int nmi_enable;
  65.  
  66. WRITE_HANDLER( brkthru_1803_w )
  67. {
  68.     /* bit 0 = NMI enable */
  69.     nmi_enable = ~data & 1;
  70.  
  71.     /* bit 1 = ? maybe IRQ acknowledge */
  72. }
  73. WRITE_HANDLER( darwin_0803_w )
  74. {
  75.     /* bit 0 = NMI enable */
  76.     /*nmi_enable = ~data & 1;*/
  77.     logerror("0803 %02X\n",data);
  78.         nmi_enable = data;
  79.     /* bit 1 = ? maybe IRQ acknowledge */
  80. }
  81.  
  82. WRITE_HANDLER( brkthru_soundlatch_w )
  83. {
  84.     soundlatch_w(offset,data);
  85.     cpu_cause_interrupt(1,M6809_INT_NMI);
  86. }
  87.  
  88.  
  89.  
  90. static struct MemoryReadAddress readmem[] =
  91. {
  92.     { 0x0000, 0x03ff, MRA_RAM },        /* Plane 0: Text */
  93.     { 0x0400, 0x0bff, MRA_RAM },
  94.     { 0x0c00, 0x0fff, MRA_RAM },        /* Plane 2  Background */
  95.     { 0x1000, 0x10ff, MRA_RAM },        /* Plane 1: Sprites */
  96.     { 0x1100, 0x17ff, MRA_RAM },
  97.     { 0x1800, 0x1800, input_port_0_r },    /* player controls, player start */
  98.     { 0x1801, 0x1801, input_port_1_r },    /* cocktail player controls */
  99.     { 0x1802, 0x1802, input_port_3_r },    /* DSW 0 */
  100.     { 0x1803, 0x1803, input_port_2_r },    /* coin input & DSW */
  101.     { 0x2000, 0x3fff, MRA_BANK1 },
  102.     { 0x4000, 0xffff, MRA_ROM },
  103.     { -1 }  /* end of table */
  104. };
  105.  
  106. static struct MemoryWriteAddress writemem[] =
  107. {
  108.     { 0x0000, 0x03ff, MWA_RAM, &brkthru_videoram, &brkthru_videoram_size },
  109.     { 0x0400, 0x0bff, MWA_RAM },
  110.     { 0x0c00, 0x0fff, videoram_w, &videoram, &videoram_size },
  111.     { 0x1000, 0x10ff, MWA_RAM, &spriteram, &spriteram_size },
  112.     { 0x1100, 0x17ff, MWA_RAM },
  113.     { 0x1800, 0x1801, brkthru_1800_w },    /* bg scroll and color, ROM bank selection, flip screen */
  114.     { 0x1802, 0x1802, brkthru_soundlatch_w },
  115.     { 0x1803, 0x1803, brkthru_1803_w },    /* NMI enable, + ? */
  116.     { 0x2000, 0xffff, MWA_ROM },
  117.     { -1 }  /* end of table */
  118. };
  119. static struct MemoryReadAddress darwin_readmem[] =
  120. {
  121.     { 0x1000, 0x13ff, MRA_RAM },        /* Plane 0: Text */
  122.     { 0x0400, 0x07ff, MRA_RAM },
  123.     { 0x1c00, 0x1fff, MRA_RAM },        /* Plane 2  Background */
  124.     { 0x0000, 0x00ff, MRA_RAM },        /* Plane 1: Sprites */
  125.      { 0x1400, 0x1bff, MRA_RAM },
  126.     { 0x0800, 0x0800, input_port_0_r },    /* player controls, player start */
  127.     { 0x0801, 0x0801, input_port_1_r },    /* cocktail player controls */
  128.     { 0x0802, 0x0802, input_port_3_r },    /* DSW 0 */
  129.     { 0x0803, 0x0803, input_port_2_r },    /* coin input & DSW */
  130.     { 0x2000, 0x3fff, MRA_BANK1 },
  131.     { 0x4000, 0xffff, MRA_ROM },
  132.     { -1 }  /* end of table */
  133. };
  134.  
  135. static struct MemoryWriteAddress darwin_writemem[] =
  136. {
  137.     { 0x1000, 0x13ff, MWA_RAM, &brkthru_videoram, &brkthru_videoram_size },
  138.     { 0x1c00, 0x1fff, videoram_w, &videoram, &videoram_size },
  139.     { 0x0000, 0x00ff, MWA_RAM, &spriteram, &spriteram_size },
  140.     { 0x1400, 0x1bff, MWA_RAM },
  141.     { 0x0100, 0x01ff, MWA_NOP  }, /*tidyup, nothing realy here?*/
  142.     { 0x0800, 0x0801, brkthru_1800_w },     /* bg scroll and color, ROM bank selection, flip screen */
  143.     { 0x0802, 0x0802, brkthru_soundlatch_w },
  144.     { 0x0803, 0x0803, darwin_0803_w },     /* NMI enable, + ? */
  145.     { 0x2000, 0xffff, MWA_ROM },
  146.     { -1 }  /* end of table */
  147. };
  148.  
  149. static struct MemoryReadAddress sound_readmem[] =
  150. {
  151.     { 0x0000, 0x1fff, MRA_RAM },
  152.     { 0x4000, 0x4000, soundlatch_r },
  153.     { 0x6000, 0x6000, YM2203_status_port_0_r },
  154.     { 0x8000, 0xffff, MRA_ROM },
  155.     { -1 }  /* end of table */
  156. };
  157.  
  158. static struct MemoryWriteAddress sound_writemem[] =
  159. {
  160.     { 0x0000, 0x1fff, MWA_RAM },
  161.     { 0x2000, 0x2000, YM3526_control_port_0_w  },
  162.     { 0x2001, 0x2001, YM3526_write_port_0_w },
  163.     { 0x6000, 0x6000, YM2203_control_port_0_w },
  164.     { 0x6001, 0x6001, YM2203_write_port_0_w },
  165.     { 0x8000, 0xffff, MWA_ROM },
  166.     { -1 }  /* end of table */
  167. };
  168.  
  169.  
  170.  
  171. int brkthru_interrupt(void)
  172. {
  173.     if (cpu_getiloops() == 0)
  174.     {
  175.         if (nmi_enable) return nmi_interrupt();
  176.     }
  177.     else
  178.     {
  179.         /* generate IRQ on coin insertion */
  180.         if ((readinputport(2) & 0xe0) != 0xe0) return interrupt();
  181.     }
  182.  
  183.     return ignore_interrupt();
  184. }
  185.  
  186. INPUT_PORTS_START( brkthru )
  187.     PORT_START    /* IN0 */
  188.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  189.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  190.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  191.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  192.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  193.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  194.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  195.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  196.  
  197.     PORT_START    /* IN1 */
  198.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  199.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  200.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  201.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  202.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  203.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  204.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  205.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )    /* used only by the self test */
  206.  
  207.     PORT_START    /* IN2 */
  208.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  209.     PORT_DIPSETTING(    0x02, "2" )
  210.     PORT_DIPSETTING(    0x03, "3" )
  211.     PORT_DIPSETTING(    0x01, "5" )
  212.     PORT_BITX(0,        0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "99", IP_KEY_NONE, IP_JOY_NONE )
  213.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  214.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  215.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  216.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
  217.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  219.     PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
  220.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  221.     PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
  222.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN1, 2 )
  223.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN2, 2 )
  224.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1, 2 )
  225.  
  226.     PORT_START      /* DSW0 */
  227.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  228.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  229.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  230.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  231.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  232.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  233.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  234.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  235.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  236.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  237.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  238.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  239.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  240.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
  241.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  242.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  243.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
  244.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  245.     PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
  246.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  247.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  248.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  249. INPUT_PORTS_END
  250.  
  251. INPUT_PORTS_START( darwin )
  252.     PORT_START    /* IN0 */
  253.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  254.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  255.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  256.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  257.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  258.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  259.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  260.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  261.  
  262.     PORT_START    /* IN1 */
  263.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  264.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  265.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  266.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  267.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  268.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  269.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  270.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
  271.  
  272.     PORT_START    /* IN2 modified by Shingo Suzuki 1999/11/02 */
  273.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  274.     PORT_DIPSETTING(    0x01, "3" )
  275.     PORT_DIPSETTING(    0x00, "5" )
  276.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
  277.     PORT_DIPSETTING(    0x02, "20k 50k and every 50k" )
  278.     PORT_DIPSETTING(    0x00, "30k 80k and every 80k" )
  279.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  280.     PORT_DIPSETTING(    0x0c, "Easy" )
  281.     PORT_DIPSETTING(    0x08, "Medium" )
  282.     PORT_DIPSETTING(    0x04, "Hard" )
  283.     PORT_DIPSETTING(    0x00, "Hardest" )
  284.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  285.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  286.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  287.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN1, 2 )
  288.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN2, 2 )
  289.     PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1, 2 )
  290.  
  291.     PORT_START      /* DSW0 */
  292.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  293.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  294.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  295.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  296.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  297.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  299.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  300.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  301.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  302.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  303.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  304.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  305.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
  306.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  307.     PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )
  308.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
  309.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  310.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  311.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  312.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  313.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  314. INPUT_PORTS_END
  315.  
  316.  
  317. static struct GfxLayout charlayout =
  318. {
  319.     8,8,    /* 8*8 chars */
  320.     256,    /* 256 characters */
  321.     3,    /* 3 bits per pixel */
  322.     { 512*8*8+4, 0, 4 },    /* plane offset */
  323.     { 256*8*8+0, 256*8*8+1, 256*8*8+2, 256*8*8+3, 0, 1, 2, 3 },
  324.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  325.     8*8    /* every char takes 8 consecutive bytes */
  326. };
  327.  
  328. static struct GfxLayout tilelayout1 =
  329. {
  330.     16,16,    /* 16*16 tiles */
  331.     128,    /* 128 tiles */
  332.     3,    /* 3 bits per pixel */
  333.     { 0x4000*8+4, 0, 4 },    /* plane offset */
  334.     { 0, 1, 2, 3, 1024*8*8+0, 1024*8*8+1, 1024*8*8+2, 1024*8*8+3,
  335.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+1024*8*8+0, 16*8+1024*8*8+1, 16*8+1024*8*8+2, 16*8+1024*8*8+3 },
  336.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  337.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  338.     32*8    /* every tile takes 32 consecutive bytes */
  339. };
  340.  
  341. static struct GfxLayout tilelayout2 =
  342. {
  343.     16,16,    /* 16*16 tiles */
  344.     128,    /* 128 tiles */
  345.     3,    /* 3 bits per pixel */
  346.     { 0x3000*8+0, 0, 4 },    /* plane offset */
  347.     { 0, 1, 2, 3, 1024*8*8+0, 1024*8*8+1, 1024*8*8+2, 1024*8*8+3,
  348.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+1024*8*8+0, 16*8+1024*8*8+1, 16*8+1024*8*8+2, 16*8+1024*8*8+3 },
  349.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  350.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  351.     32*8    /* every tile takes 32 consecutive bytes */
  352. };
  353.  
  354. static struct GfxLayout spritelayout =
  355. {
  356.     16,16,    /* 16*16 sprites */
  357.     1024,    /* 1024 sprites */
  358.     3,    /* 3 bits per pixel */
  359.     { 2*1024*32*8, 1024*32*8, 0 },    /* plane offset */
  360.     { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
  361.             0, 1, 2, 3, 4, 5, 6, 7 },
  362.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  363.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  364.     32*8    /* every sprite takes 32 consecutive bytes */
  365. };
  366.  
  367. static struct GfxDecodeInfo gfxdecodeinfo[] =
  368. {
  369.     { REGION_GFX1, 0x00000, &charlayout,      0, 1 },
  370.     { REGION_GFX2, 0x00000, &tilelayout1, 8+8*8, 16 },
  371.     { REGION_GFX2, 0x01000, &tilelayout2, 8+8*8, 16 },
  372.     { REGION_GFX2, 0x08000, &tilelayout1, 8+8*8, 16 },
  373.     { REGION_GFX2, 0x09000, &tilelayout2, 8+8*8, 16 },
  374.     { REGION_GFX2, 0x10000, &tilelayout1, 8+8*8, 16 },
  375.     { REGION_GFX2, 0x11000, &tilelayout2, 8+8*8, 16 },
  376.     { REGION_GFX2, 0x18000, &tilelayout1, 8+8*8, 16 },
  377.     { REGION_GFX2, 0x19000, &tilelayout2, 8+8*8, 16 },
  378.     { REGION_GFX3, 0x00000, &spritelayout,    8, 8 },
  379.     { -1 } /* end of array */
  380. };
  381.  
  382. /* handler called by the 3812 emulator when the internal timers cause an IRQ */
  383. static void irqhandler(int linestate)
  384. {
  385.     cpu_set_irq_line(1,0,linestate);
  386.     //cpu_cause_interrupt(1,M6809_INT_IRQ);
  387. }
  388.  
  389. static struct YM2203interface ym2203_interface =
  390. {
  391.     1,
  392.     1500000,    /* Unknown */
  393.     { YM2203_VOL(25,25) },
  394.     { 0 },
  395.     { 0 },
  396.     { 0 },
  397.     { 0 }
  398. };
  399.  
  400. static struct YM3526interface ym3526_interface =
  401. {
  402.     1,            /* 1 chip (no more supported) */
  403.     3000000,    /* 3.000000 MHz ? (partially supported) */
  404.     { 255 },        /* (not supported) */
  405.     { irqhandler },
  406. };
  407.  
  408.  
  409.  
  410. static struct MachineDriver machine_driver_brkthru =
  411. {
  412.     /* basic machine hardware */
  413.     {
  414.         {
  415.             CPU_M6809,
  416.             1250000,        /* 1.25 Mhz ? */
  417.             readmem,writemem,0,0,
  418.             brkthru_interrupt,2
  419.         },
  420.         {
  421.             CPU_M6809 | CPU_AUDIO_CPU,
  422.             1250000,        /* 1.25 Mhz ? */
  423.             sound_readmem,sound_writemem,0,0,
  424.             ignore_interrupt,0    /* IRQs are caused by the YM3526 */
  425.         }
  426.     },
  427.     58, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration (not sure) */
  428.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  429.     0,    /* init machine */
  430.  
  431.     /* video hardware */
  432.     32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },    /* not sure */
  433.     gfxdecodeinfo,
  434.     256,8+8*8+16*8,
  435.     brkthru_vh_convert_color_prom,
  436.  
  437.     VIDEO_TYPE_RASTER,
  438.     0,
  439.     brkthru_vh_start,
  440.     brkthru_vh_stop,
  441.     brkthru_vh_screenrefresh,
  442.  
  443.     /* sound hardware */
  444.     0,0,0,0,
  445.     {
  446.         {
  447.             SOUND_YM2203,
  448.             &ym2203_interface
  449.         },
  450.         {
  451.             SOUND_YM3526,
  452.             &ym3526_interface
  453.         }
  454.     }
  455. };
  456.  
  457. static struct MachineDriver machine_driver_darwin =
  458. {
  459.     /* basic machine hardware */
  460.     {
  461.         {
  462.             CPU_M6809,
  463.             1500000,        /* 1.25 Mhz ? */
  464.             darwin_readmem,darwin_writemem,0,0,
  465.             brkthru_interrupt,2
  466.         },
  467.         {
  468.             CPU_M6809 | CPU_AUDIO_CPU,
  469.             1500000,        /* 1.25 Mhz ? */
  470.             sound_readmem,sound_writemem,0,0,
  471.             ignore_interrupt,0    /* IRQs are caused by the YM3526 */
  472.         }
  473.     },
  474.     58, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration / 60->58 tuned by Shingo Suzuki 1999/10/16 */
  475.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  476.     0,    /* init machine */
  477.  
  478.     /* video hardware */
  479.     32*8, 32*8, { 1*8, 31*8-1, 1*8, 31*8-1 },
  480.     gfxdecodeinfo,
  481.     256,8+8*8+16*8,
  482.     brkthru_vh_convert_color_prom,
  483.  
  484.     VIDEO_TYPE_RASTER ,
  485.     0,
  486.     brkthru_vh_start,
  487.     brkthru_vh_stop,
  488.     brkthru_vh_screenrefresh,
  489.  
  490.     /* sound hardware */
  491.     0,0,0,0,
  492.     {
  493.         {
  494.             SOUND_YM2203,
  495.             &ym2203_interface
  496.         },
  497.         {
  498.             SOUND_YM3526,
  499.             &ym3526_interface
  500.         }
  501.     }
  502. };
  503.  
  504.  
  505. /***************************************************************************
  506.  
  507.   Game driver(s)
  508.  
  509. ***************************************************************************/
  510.  
  511. ROM_START( brkthru )
  512.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for main CPU + 64k for banked ROMs */
  513.     ROM_LOAD( "brkthru.1",    0x04000, 0x4000, 0xcfb4265f )
  514.     ROM_LOAD( "brkthru.2",    0x08000, 0x8000, 0xfa8246d9 )
  515.     ROM_LOAD( "brkthru.4",    0x10000, 0x8000, 0x8cabf252 )
  516.     ROM_LOAD( "brkthru.3",    0x18000, 0x8000, 0x2f2c40c2 )
  517.  
  518.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  519.     ROM_LOAD( "brkthru.12",   0x00000, 0x2000, 0x58c0b29b )    /* characters */
  520.  
  521.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  522.     /* background */
  523.     /* we do a lot of scatter loading here, to place the data in a format */
  524.     /* which can be decoded by MAME's standard functions */
  525.     ROM_LOAD( "brkthru.7",    0x00000, 0x4000, 0x920cc56a )    /* bitplanes 1,2 for bank 1,2 */
  526.     ROM_CONTINUE(             0x08000, 0x4000 )                /* bitplanes 1,2 for bank 3,4 */
  527.     ROM_LOAD( "brkthru.6",    0x10000, 0x4000, 0xfd3cee40 )    /* bitplanes 1,2 for bank 5,6 */
  528.     ROM_CONTINUE(             0x18000, 0x4000 )                /* bitplanes 1,2 for bank 7,8 */
  529.     ROM_LOAD( "brkthru.8",    0x04000, 0x1000, 0xf67ee64e )    /* bitplane 3 for bank 1,2 */
  530.     ROM_CONTINUE(             0x06000, 0x1000 )
  531.     ROM_CONTINUE(             0x0c000, 0x1000 )                /* bitplane 3 for bank 3,4 */
  532.     ROM_CONTINUE(             0x0e000, 0x1000 )
  533.     ROM_CONTINUE(             0x14000, 0x1000 )                /* bitplane 3 for bank 5,6 */
  534.     ROM_CONTINUE(             0x16000, 0x1000 )
  535.     ROM_CONTINUE(             0x1c000, 0x1000 )                /* bitplane 3 for bank 7,8 */
  536.     ROM_CONTINUE(             0x1e000, 0x1000 )
  537.  
  538.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  539.     ROM_LOAD( "brkthru.9",    0x00000, 0x8000, 0xf54e50a7 )    /* sprites */
  540.     ROM_LOAD( "brkthru.10",   0x08000, 0x8000, 0xfd156945 )
  541.     ROM_LOAD( "brkthru.11",   0x10000, 0x8000, 0xc152a99b )
  542.  
  543.     ROM_REGION( 0x0200, REGION_PROMS )
  544.     ROM_LOAD( "brkthru.13",   0x0000, 0x0100, 0xaae44269 ) /* red and green component */
  545.     ROM_LOAD( "brkthru.14",   0x0100, 0x0100, 0xf2d4822a ) /* blue component */
  546.  
  547.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64K for sound CPU */
  548.     ROM_LOAD( "brkthru.5",    0x8000, 0x8000, 0xc309435f )
  549. ROM_END
  550.  
  551. ROM_START( brkthruj )
  552.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for main CPU + 64k for banked ROMs */
  553.     ROM_LOAD( "1",            0x04000, 0x4000, 0x09bd60ee )
  554.     ROM_LOAD( "2",            0x08000, 0x8000, 0xf2b2cd1c )
  555.     ROM_LOAD( "4",            0x10000, 0x8000, 0xb42b3359 )
  556.     ROM_LOAD( "brkthru.3",    0x18000, 0x8000, 0x2f2c40c2 )
  557.  
  558.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  559.     ROM_LOAD( "12",   0x00000, 0x2000, 0x3d9a7003 )    /* characters */
  560.  
  561.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  562.     /* background */
  563.     /* we do a lot of scatter loading here, to place the data in a format */
  564.     /* which can be decoded by MAME's standard functions */
  565.     ROM_LOAD( "brkthru.7",    0x00000, 0x4000, 0x920cc56a )    /* bitplanes 1,2 for bank 1,2 */
  566.     ROM_CONTINUE(             0x08000, 0x4000 )                /* bitplanes 1,2 for bank 3,4 */
  567.     ROM_LOAD( "6",            0x10000, 0x4000, 0xcb47b395 )    /* bitplanes 1,2 for bank 5,6 */
  568.     ROM_CONTINUE(             0x18000, 0x4000 )                /* bitplanes 1,2 for bank 7,8 */
  569.     ROM_LOAD( "8",            0x04000, 0x1000, 0x5e5a2cd7 )    /* bitplane 3 for bank 1,2 */
  570.     ROM_CONTINUE(             0x06000, 0x1000 )
  571.     ROM_CONTINUE(             0x0c000, 0x1000 )                /* bitplane 3 for bank 3,4 */
  572.     ROM_CONTINUE(             0x0e000, 0x1000 )
  573.     ROM_CONTINUE(             0x14000, 0x1000 )                /* bitplane 3 for bank 5,6 */
  574.     ROM_CONTINUE(             0x16000, 0x1000 )
  575.     ROM_CONTINUE(             0x1c000, 0x1000 )                /* bitplane 3 for bank 7,8 */
  576.     ROM_CONTINUE(             0x1e000, 0x1000 )
  577.  
  578.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  579.     ROM_LOAD( "brkthru.9",    0x00000, 0x8000, 0xf54e50a7 )    /* sprites */
  580.     ROM_LOAD( "brkthru.10",   0x08000, 0x8000, 0xfd156945 )
  581.     ROM_LOAD( "brkthru.11",   0x10000, 0x8000, 0xc152a99b )
  582.  
  583.     ROM_REGION( 0x0200, REGION_PROMS )
  584.     ROM_LOAD( "brkthru.13",   0x0000, 0x0100, 0xaae44269 ) /* red and green component */
  585.     ROM_LOAD( "brkthru.14",   0x0100, 0x0100, 0xf2d4822a ) /* blue component */
  586.  
  587.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64K for sound CPU */
  588.     ROM_LOAD( "brkthru.5",    0x8000, 0x8000, 0xc309435f )
  589. ROM_END
  590.  
  591. ROM_START( darwin )
  592.     ROM_REGION( 0x20000, REGION_CPU1 )     /* 64k for main CPU + 64k for banked ROMs */
  593.     ROM_LOAD( "darw_04.rom",  0x04000, 0x4000, 0x0eabf21c )
  594.     ROM_LOAD( "darw_05.rom",  0x08000, 0x8000, 0xe771f864 )
  595.     ROM_LOAD( "darw_07.rom",  0x10000, 0x8000, 0x97ac052c )
  596.     ROM_LOAD( "darw_06.rom",  0x18000, 0x8000, 0x2a9fb208 )
  597.  
  598.     ROM_REGION( 0x02000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  599.     ROM_LOAD( "darw_09.rom",  0x00000, 0x2000, 0x067b4cf5 )   /* characters */
  600.  
  601.     ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  602.     /* background */
  603.     /* we do a lot of scatter loading here, to place the data in a format */
  604.     /* which can be decoded by MAME's standard functions */
  605.     ROM_LOAD( "darw_03.rom",  0x00000, 0x4000, 0x57d0350d )    /* bitplanes 1,2 for bank 1,2 */
  606.     ROM_CONTINUE(             0x08000, 0x4000 )                /* bitplanes 1,2 for bank 3,4 */
  607.     ROM_LOAD( "darw_02.rom",  0x10000, 0x4000, 0x559a71ab )    /* bitplanes 1,2 for bank 5,6 */
  608.     ROM_CONTINUE(             0x18000, 0x4000 )                /* bitplanes 1,2 for bank 7,8 */
  609.     ROM_LOAD( "darw_01.rom",  0x04000, 0x1000, 0x15a16973 )    /* bitplane 3 for bank 1,2 */
  610.     ROM_CONTINUE(             0x06000, 0x1000 )
  611.     ROM_CONTINUE(             0x0c000, 0x1000 )                /* bitplane 3 for bank 3,4 */
  612.     ROM_CONTINUE(             0x0e000, 0x1000 )
  613.     ROM_CONTINUE(             0x14000, 0x1000 )                /* bitplane 3 for bank 5,6 */
  614.     ROM_CONTINUE(             0x16000, 0x1000 )
  615.     ROM_CONTINUE(             0x1c000, 0x1000 )                /* bitplane 3 for bank 7,8 */
  616.     ROM_CONTINUE(             0x1e000, 0x1000 )
  617.  
  618.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  619.     ROM_LOAD( "darw_10.rom",  0x00000, 0x8000, 0x487a014c )    /* sprites */
  620.     ROM_LOAD( "darw_11.rom",  0x08000, 0x8000, 0x548ce2d1 )
  621.     ROM_LOAD( "darw_12.rom",  0x10000, 0x8000, 0xfaba5fef )
  622.  
  623.     ROM_REGION( 0x0200, REGION_PROMS )
  624.     ROM_LOAD( "df.12",   0x0000, 0x0100, 0x89b952ef ) /* red and green component */
  625.     ROM_LOAD( "df.13",   0x0100, 0x0100, 0xd595e91d ) /* blue component */
  626.  
  627.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64K for sound CPU */
  628.     ROM_LOAD( "darw_08.rom",  0x8000, 0x8000, 0x6b580d58 )
  629. ROM_END
  630.  
  631.  
  632.  
  633. GAME( 1986, brkthru,  0,       brkthru, brkthru, 0, ROT0,   "Data East USA", "Break Thru (US)" )
  634. GAME( 1986, brkthruj, brkthru, brkthru, brkthru, 0, ROT0,   "Data East Corporation", "Kyohkoh-Toppa (Japan)" )
  635. GAME( 1986, darwin,   0,       darwin,  darwin,  0, ROT270, "Data East Corporation", "Darwin 4078 (Japan)" )
  636.